package leader.print;

import java.util.List;

import leader.service.DirectTeacherService;
import leader.tool.JTableDefine;

import teacher.bean.Award;
import teacher.bean.Teacher;
import tools.StringDate;

public class AwardPrint {
	public void printAward(List<Award> lists) {
		System.out.println(lists.size());
		DirectTeacherService DT = new DirectTeacherService();
		String[][] columnNames = new String[lists.size()+1][7];		
		columnNames[0] = new String[]{"编号","名称","获奖人员","通讯人员","获奖级别","获奖日期","授奖单位"};
		for(int i=1;i<lists.size()+1;i++) {
			Award award = lists.get(i-1);
			columnNames[i][0] = String.valueOf(i);
			columnNames[i][1] = award.getName();
			columnNames[i][2] = award.getPeople();
			Teacher tea = new Teacher();
			tea.setTeaId(award.getTeaId());			
			columnNames[i][3] = DT.selectTeacherById(tea).getName();
			columnNames[i][4] = String.valueOf(award.getLevel());
			StringDate date = new StringDate();
			columnNames[i][5] = date.DateToString(award.getDate());
			columnNames[i][6] = String.valueOf(award.getEmpowerUnit());
		}
		int[] px = new int[]{40,120,105,50,50,80,80};
		JTableDefine d = new JTableDefine();
		d.printTable(columnNames,px);
		System.out.println("============================");
	}
}
